﻿using Db4objects.Db4o;

namespace DataAccess
{

    /// <summary>
    /// Delete action class.
    /// </summary>
    class DeleteAction : IUpdateAction
    {

        /// <summary>
        /// The object to be deleted from the database.
        /// </summary>
        private object objectToDelete;


        /// <summary>
        /// DeleteAction constructor.
        /// </summary>
        /// <param name="objectToDelete">The object to be deleted from the database</param>
        public DeleteAction(object objectToDelete)
        {
            this.objectToDelete = objectToDelete;
        }


        /// <summary>
        /// Performs the delete action against the database.
        /// </summary>
        /// <param name="db">The database handle</param>
        public void PerformUpdate(IObjectContainer db)
        {
            db.Delete(objectToDelete);
        }

    }

}
